package com.itheima.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper {

    /**
     * 根据条件查询总会员数
     * @param map
     * @return
     */
    Integer countByMap(Map map);

    /**
     * 按月统计会员数量
     * @param beginTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> getMemberCountByMonth(@Param("beginTime") LocalDateTime beginTime,
                                                    @Param("endTime") LocalDateTime endTime);

    /**
     * 获取套餐预约数量
     * @return
     */
    List<Map<String, Object>> getSetmealReport();

    /**
     * 按月统计预约和到诊数量
     * @param beginTime
     * @param endTime
     * @return
     */
    List<Map<String, Object>> getOrderCountByMonth(@Param("beginTime") LocalDateTime beginTime,
                                                   @Param("endTime") LocalDateTime endTime);

    // 会员统计相关方法
    Integer getTodayNewMember(LocalDate date);
    Integer getTotalMember();
    Integer getThisWeekNewMember(LocalDate weekFirstDay);
    Integer getThisMonthNewMember(LocalDate monthFirstDay);

    // 预约到诊相关方法
    Integer getTodayOrderNumber(LocalDate date);
    Integer getTodayVisitsNumber(LocalDate date);
    Integer getThisWeekOrderNumber(LocalDate weekFirstDay);
    Integer getThisWeekVisitsNumber(LocalDate weekFirstDay);
    Integer getThisMonthOrderNumber(LocalDate monthFirstDay);
    Integer getThisMonthVisitsNumber(LocalDate monthFirstDay);

    // 热门套餐查询
    List<Map<String, Object>> getHotSetmeal();

}
